home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Blitter / DrawLine.s < prev    next >
Encoding:
Text File  |  1997-07-08  |  2.1 KB  |  101 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Draw Line
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo draws a line which you can control with the mouse.
  7.  
  8.     INCDIR    "INCLUDES:"
  9.     INCLUDE    "games/games_lib.i"
  10.     INCLUDE    "games/games.i"
  11.  
  12. ;===========================================================================;
  13. ;                             INITIALISE DEMO
  14. ;===========================================================================;
  15.  
  16.     SECTION    "DrawLine",CODE
  17.  
  18. Start:    STARTGMS
  19.  
  20.     MOVEM.L    A0-A6/D1-D7,-(SP)
  21.     move.l    GMSBase(pc),a6
  22.     CALL    AllocBlitter
  23.     tst.l    d0
  24.     bne.s    .Error_Blitter
  25.  
  26.     lea    ScreenTags(pc),a0
  27.     CALL    ShowScreen
  28.     tst.l    d0
  29.     beq.s    .Error_Screen
  30.  
  31.     CALL    InitJoyPorts
  32.  
  33.     bsr.s    Loop
  34.  
  35. .ReturnToDOS
  36.     move.l    GMSBase(pc),a6
  37.     move.l    Screen(pc),a0
  38.     CALL    DeleteScreen
  39. .Error_Screen
  40.     CALL    FreeBlitter
  41. .Error_Blitter
  42.     MOVEM.L    (SP)+,A0-A6/D1-D7
  43.     moveq    #ERR_OK,d0
  44.     rts
  45.  
  46. ;===========================================================================;
  47. ;                                MAIN LOOP
  48. ;===========================================================================;
  49.  
  50. Loop:    move.l    Screen(pc),a0
  51.     move.l    GS_Bitmap(a0),a0
  52.     CALL    ClearBitmap
  53.  
  54.     moveq    #JPORT1,d0
  55.     moveq    #JT_ZBXY,d1
  56.     CALL    ReadJoyPort
  57.     btst    #MB_RMB,d0
  58.     bne.s    .done
  59.     lea    MouseDXY(pc),a1
  60.     btst    #MB_LMB,d0
  61.     beq.s    .no
  62.     lea    MouseSXY(pc),a1
  63. .no    move.w    d0,d1
  64.     ext.w    d1
  65.     add.w    d1,2(a1)
  66.     asr.w    #8,d0
  67.     add.w    d0,(a1)
  68.  
  69. .Draw    move.l    Screen(pc),a0
  70.     move.l    GS_Bitmap(a0),a0
  71.     movem.w    MouseSXY(pc),d1/d2/d3/d4    ;d1 = XStart, YStart, XEnd, YEnd.
  72.     moveq    #2,d5    ;d5 = Colour
  73.     CALL    DrawLine
  74.     CALL    WaitVBL
  75.     move.l    Screen(pc),a0
  76.     CALL    SwapBuffers
  77.     bra.s    Loop
  78. .done    rts
  79.  
  80. MouseSXY
  81.     dc.w    160,128
  82. MouseDXY
  83.     dc.w    40,40
  84.  
  85. ;===========================================================================;
  86. ;                                  DATA
  87. ;===========================================================================;
  88.  
  89. ScreenTags:
  90.     dc.l    TAGS_GAMESCREEN
  91. Screen:    dc.l    0
  92.     dc.l    GSA_Palette,.palette
  93.     dc.l    GSA_AmtColours,4
  94.     dc.l    GSA_ScrWidth,640
  95.     dc.l    GSA_ScrHeight,256
  96.     dc.l    GSA_Attrib,DBLBUFFER
  97.     dc.l    GSA_ScrMode,HIRES
  98.     dc.l    TAGEND
  99. .palette
  100.     dc.l    $000000,$f0f0f0,$f000f0,$f00000
  101.